package com.gitee.wsl.ext.number

/** Converts this [Boolean] into integer: 1 for true, 0 for false */
fun Boolean.toInt(): Int = if (this) 1 else 0

fun Boolean.toByte(): Byte = if (this) 1 else 0

fun Byte.toBoolean(): Boolean = this.toInt() != 0

/**
 * Converts this number to a Boolean.
 *
 * @return true if this number is not zero, false otherwise.
 */
fun Number.toBoolean() = this != 0